<template>
  <h2>-----监视练习-----</h2>
  <el-button @click="x++">修改x</el-button>
  <el-button @click="y++">修改y</el-button>
</template>
<script setup>
import { ref, watch } from "vue";
const x = ref(2);
const y = ref(6);

// watch(
//   () => x.value + y.value,
//   (s) => {
//     console.log("监视s", s);
//   },
//   { immediate: true }
// );

watch([x, y], ([xn, yn], [xo, yo]) => {
  console.log(xn, yn, xo, yo);
});
</script>
<style lang="scss" scoped></style>
